from django.shortcuts import render

# Create your views here.
from rest_framework.generics import ListAPIView
from .models import Banner
from .serializers import BannerModelSerializer

from luffyapi.settings import constants


# 继承ListAPIView
class BannerListAPIView(ListAPIView):  # 自动导包alt+回车键盘
    queryset = Banner.objects.filter(is_show=True, is_deleted=False).order_by("-orders", "-id")[
               :constants.BANNER_LENGTH]
    serializer_class = BannerModelSerializer
    # 继承ListAPIView中已经有get方法，所有相当于在这里写了get方法,直接写路径即可
    # def get(self, request, *args, **kwargs):
    #     return self.list(request, *args, **kwargs)
